#include "biosagelabel.h"

BioSageLabel::BioSageLabel(QString t, QColor textColor, QGraphicsItem *parent) :
    text( t ), color( textColor ), QGraphicsWidget( parent )
{

}

BioSageLabel::BioSageLabel( const BioSageLabel & other ) :
    text( other.text) , color( other.color ),  QGraphicsWidget(other.parentItem())
{

}

QRectF BioSageLabel::boundingRect() const
{
    qreal adjust = 2;
    return QRectF(-25, -25, 50, 50 );//-15 - adjust, -15 - adjust,
                  //23 + adjust, 23 + adjust);
}

QPainterPath BioSageLabel::shape() const
{
    QPainterPath path;
    QRectF myRect = boundingRect();
    path.addRect(myRect);
    return path;
}

void BioSageLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{

    QColor background(40, 40, 40, 255 );
    painter->setBrush(background);

    QRectF bRect = boundingRect();
    bRect.adjust(1, 1, -1, -1);
    painter->drawRect(bRect);

    qDebug() << "inside bio sage label paint" << endl;
    QFont f;
    f.setPointSize(10);
    painter->setFont(f);
    painter->setPen(Qt::white);//QPen(color) );//Qt::lightGray));
    painter->drawText(QPointF(0,0), text) ;//Qt::AlignCenter, text, &boundingRect());
}
